QT       += core gui network widgets

TARGET = SshTool
TEMPLATE = app
CONFIG += c++11

# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS

# You can also make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0

# Source files
SOURCES += \
    $$PWD/src/main.cpp \
    $$PWD/src/mainwindow.cpp \
    $$PWD/src/sshmanager.cpp \
    $$PWD/src/sshsession.cpp \
    $$PWD/src/terminalwidget.cpp \
    $$PWD/src/sftpmanager.cpp \
    $$PWD/src/configdialog.cpp \
    $$PWD/src/connectionmanager.cpp

# Header files
HEADERS += \
    $$PWD/src/mainwindow.h \
    $$PWD/src/sshmanager.h \
    $$PWD/src/sshsession.h \
    $$PWD/src/terminalwidget.h \
    $$PWD/src/sftpmanager.h \
    $$PWD/src/configdialog.h \
    $$PWD/src/connectionmanager.h

# Forms
FORMS += \
    src/mainwindow.ui \
    src/configdialog.ui

# libssh2 library configuration
win32 {
    # Adjust these paths according to your libssh2 installation
    LIBSSH2_PATH = $$PWD/tools/libssh2
    ZLIB_PATH = $$PWD/tools/zlib
    OPENSSL_PATH = $$PWD/tools/openssl

    INCLUDEPATH += $$LIBSSH2_PATH/include
    INCLUDEPATH += $$ZLIB_PATH/include
    INCLUDEPATH += $$OPENSSL_PATH/include

    # Use dynamic libraries
    LIBS += -L$$LIBSSH2_PATH/lib -llibssh2
    LIBS += -L$$ZLIB_PATH/lib -lzlib
    LIBS += -L$$OPENSSL_PATH/lib -llibssl -llibcrypto

    # Required Windows libraries for networking
    LIBS += -lws2_32 -lcrypt32 -lgdi32

    # For static linking alternative
    # LIBS += -L$$LIBSSH2_PATH/lib -llibssh2_static
    # LIBS += -L$$ZLIB_PATH/lib -lzlibstatic
    # LIBS += -L$$OPENSSL_PATH/lib -llibssl_static -llibcrypto_static
}

unix {
    LIBS += -lssh2 -lz -lssl -lcrypto
}

# Add preprocessor definitions
DEFINES += LIBSSH2_STATIC WIN32_LEAN_AND_MEAN

# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

# Resource file
RESOURCES += \
    resources/resources.qrc
